import { SelectedSkuType } from '@/components/sku/typing';
import { createSlice } from '@reduxjs/toolkit'

const skuReducerSlice = createSlice({
    name: 'sku',
    initialState: {
        selectedSku: {} as SelectedSkuType,
        unit: '',
        skuChooseVisible: false,
    },
    reducers: {
        updateSkuChooseVisible(state, action) {
            state.skuChooseVisible = action.payload
        },
        updateSelectedSku(state, action) {
            state.selectedSku = action.payload
        },
    }
})

export const { updateSkuChooseVisible, updateSelectedSku } = skuReducerSlice.actions
export const skuReducer = skuReducerSlice.reducer


